package com.qpl.depression.controller;

import com.qpl.depression.common.ServerResponse;
import com.qpl.depression.entity.LeaveMessage;
import com.qpl.depression.service.LeaveMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LeaveMessageController {

    @Autowired
    private LeaveMessageService leaveMessageService;


    /**
     * 意向到店咨询 信息添加
     *
     * @param phone 手机号
     * @return 添加结果
     */
    @GetMapping("leave/message/add")
    @ResponseBody
    public ServerResponse addLeaveMessage(Long phone) {
        LeaveMessage message = new LeaveMessage();
        message.setPhone(phone);
        return leaveMessageService.save(message) ? ServerResponse.createBySuccessMessage("成功") : ServerResponse.createByErrorMessage("失败");
    }


}
